<template>
	<div class="page-wrap">
		<div class="page-content p-0">
			<div class="page-column p-0">
				<div class="page-form p-x-0">
					<el-form
						:model="ruleForm"
						:rules="rules"
						label-position="left"
						label-width="180px"
						ref="form"
						label-suffix="："
					>
						<el-row>
							<el-col :span="24">
								<div class="my_title p-b-20">撤离设置</div>
								<el-form-item label="撤离选项" prop="EZWTNAME001">
									<select-para
										style="width:100%"
										size="medium"
										class="mediumForm"
										v-model="ruleForm.EZWTNAME001"
										:label.sync="ruleForm.EZWTNAME001"
										:options="EZWTNAME001options"
									></select-para>
								</el-form-item>
								<el-form-item label="撤离人口比例" prop="EZWTFRAC001">
									<el-input
										size="medium"
										class="mediumForm"
										oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,5})?).*$/g, '$1')"
										v-model="ruleForm.EZWTFRAC001"
									></el-input>
								</el-form-item>
								<el-form-item label="撤离范围" prop="EZLASMOV001">
									<select-para
										style="width:100%"
										size="medium"
										class="mediumForm"
										v-model="ruleForm.EZLASMOV001"
										:label.sync="ruleForm.EZLASMOV001Name"
										:options="EZLASMOV001options"
										@change="EZLASMOV001Change"
									></select-para>
								</el-form-item>
								<el-form-item label="撤离类型" prop="TRAVELPOINT">
									<select-para
										style="width:100%"
										size="medium"
										class="mediumForm"
										v-model="ruleForm.TRAVELPOINT"
										:label.sync="ruleForm.TRAVELPOINT"
										:options="TRAVELPOINToptions"
									></select-para>
								</el-form-item>
								<el-form-item label="撤离" prop="EZESPEED001">
									<el-form-item label="早期" prop="EZESPEED001" label-width="70px">
										<el-input
											size="medium"
											class="mediumForm"
											oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,5})?).*$/g, '$1')"
											v-model="ruleForm.EZESPEED001[0]"
										>
											<template slot="append">m/s</template>
										</el-input>
									</el-form-item>
									<el-form-item label="中期" prop="EZESPEED001" label-width="70px">
										<el-input
											size="medium"
											class="mediumForm"
											oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,5})?).*$/g, '$1')"
											v-model="ruleForm.EZESPEED001[1]"
										>
											<template slot="append">m/s</template>
										</el-input>
									</el-form-item>
									<el-form-item label="后期" prop="EZESPEED001" label-width="70px">
										<el-input
											size="medium"
											class="mediumForm"
											oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,5})?).*$/g, '$1')"
											v-model="ruleForm.EZESPEED001[2]"
										>
											<template slot="append">m/s</template>
										</el-input>
									</el-form-item>
								</el-form-item>
								<el-form-item label="撤离方式" prop="EZEVATYP001">
									<select-para
										style="width:100%"
										size="medium"
										class="mediumForm"
										v-model="ruleForm.EZEVATYP001"
										:label.sync="ruleForm.EZEVATYP001"
										:options="EZEVATYP001options"
									></select-para>
								</el-form-item>
								<el-form-item v-if="ruleForm.EZEVATYP001=='NETWORK'" label="撤离网格文件" prop="name"></el-form-item>
								<div v-if="ruleForm.EZEVATYP001=='NETWORK'">
									<div class="operation">
										<el-button type="primary" size="small" @click="exportExcel">
											<img :style="{width: '12px',height: '12px'}" src="/img/basic/daochu.png" alt />
											&nbsp;导出
										</el-button>
										<el-button type="primary" size="small" @click="daoru()">
											<img :style="{width: '12px',height: '12px'}" src="/img/basic/daoru.png" alt />
											&nbsp;导入
										</el-button>
										<input
											ref="file"
											id="img-upload"
											class="selectFile"
											type="file"
											@change="importf(this)"
											accept=".csv, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel"
										/>
									</div>
									<el-table ref="multipleTable" :data="ruleForm.EZIDIRECTab" tooltip-effect="dark" border>
										<el-table-column prop="index" label="编号" align="center" min-width="120"></el-table-column>
										<el-table-column prop="item1" label="N" align="center" min-width="120">
											<template slot-scope="scope">
												<el-form-item
													label-width="0px"
													:rules="rules.item1"
													:prop="'EZIDIRECTab.'+scope.$index+'.item1'"
												>
													<el-input
														maxlength="1"
														oninput="this.value=this.value.replace(/[^1-4\.]/g,'')"
														class="bigForm"
														v-model="scope.row.item1"
													></el-input>
												</el-form-item>
											</template>
										</el-table-column>
										<el-table-column prop="item2" label="NNE" min-width="120" align="center">
											<template slot-scope="scope">
												<el-form-item
													label-width="0px"
													:rules="rules.item2"
													:prop="'EZIDIRECTab.'+scope.$index+'.item2'"
												>
													<el-input
														maxlength="1"
														oninput="this.value=this.value.replace(/[^1-4\.]/g,'')"
														class="bigForm"
														v-model="scope.row.item2"
													></el-input>
												</el-form-item>
											</template>
										</el-table-column>
										<el-table-column prop="item3" label="NE" align="center" min-width="120">
											<template slot-scope="scope">
												<el-form-item
													label-width="0px"
													:rules="rules.item3"
													:prop="'EZIDIRECTab.'+scope.$index+'.item3'"
												>
													<el-input
														maxlength="1"
														oninput="this.value=this.value.replace(/[^1-4\.]/g,'')"
														class="bigForm"
														v-model="scope.row.item3"
													></el-input>
												</el-form-item>
											</template>
										</el-table-column>
										<el-table-column prop="item4" label="ENE" min-width="120" align="center">
											<template slot-scope="scope">
												<el-form-item
													label-width="0px"
													:rules="rules.item4"
													:prop="'EZIDIRECTab.'+scope.$index+'.item4'"
												>
													<el-input
														maxlength="1"
														oninput="this.value=this.value.replace(/[^1-4\.]/g,'')"
														class="bigForm"
														v-model="scope.row.item4"
													></el-input>
												</el-form-item>
											</template>
										</el-table-column>
										<el-table-column prop="item5" label="E" align="center" min-width="120">
											<template slot-scope="scope">
												<el-form-item
													label-width="0px"
													:rules="rules.item5"
													:prop="'EZIDIRECTab.'+scope.$index+'.item5'"
												>
													<el-input
														maxlength="1"
														oninput="this.value=this.value.replace(/[^1-4\.]/g,'')"
														class="bigForm"
														v-model="scope.row.item5"
													></el-input>
												</el-form-item>
											</template>
										</el-table-column>
										<el-table-column prop="item6" label="ESE" min-width="120" align="center">
											<template slot-scope="scope">
												<el-form-item
													label-width="0px"
													:rules="rules.item6"
													:prop="'EZIDIRECTab.'+scope.$index+'.item6'"
												>
													<el-input
														maxlength="1"
														oninput="this.value=this.value.replace(/[^1-4\.]/g,'')"
														class="bigForm"
														v-model="scope.row.item6"
													></el-input>
												</el-form-item>
											</template>
										</el-table-column>
										<el-table-column prop="item7" label="SE" align="center" min-width="120">
											<template slot-scope="scope">
												<el-form-item
													label-width="0px"
													:rules="rules.item7"
													:prop="'EZIDIRECTab.'+scope.$index+'.item7'"
												>
													<el-input
														maxlength="1"
														oninput="this.value=this.value.replace(/[^1-4\.]/g,'')"
														class="bigForm"
														v-model="scope.row.item7"
													></el-input>
												</el-form-item>
											</template>
										</el-table-column>
										<el-table-column prop="item8" label="SSE" min-width="120" align="center">
											<template slot-scope="scope">
												<el-form-item
													label-width="0px"
													:rules="rules.item8"
													:prop="'EZIDIRECTab.'+scope.$index+'.item8'"
												>
													<el-input
														maxlength="1"
														oninput="this.value=this.value.replace(/[^1-4\.]/g,'')"
														class="bigForm"
														v-model="scope.row.item8"
													></el-input>
												</el-form-item>
											</template>
										</el-table-column>
										<el-table-column prop="item9" label="S" align="center" min-width="120">
											<template slot-scope="scope">
												<el-form-item
													label-width="0px"
													:rules="rules.item9"
													:prop="'EZIDIRECTab.'+scope.$index+'.item9'"
												>
													<el-input
														maxlength="1"
														oninput="this.value=this.value.replace(/[^1-4\.]/g,'')"
														class="bigForm"
														v-model="scope.row.item9"
													></el-input>
												</el-form-item>
											</template>
										</el-table-column>
										<el-table-column prop="item10" label="SSW" min-width="120" align="center">
											<template slot-scope="scope">
												<el-form-item
													label-width="0px"
													:rules="rules.item10"
													:prop="'EZIDIRECTab.'+scope.$index+'.item10'"
												>
													<el-input
														maxlength="1"
														oninput="this.value=this.value.replace(/[^1-4\.]/g,'')"
														class="bigForm"
														v-model="scope.row.item10"
													></el-input>
												</el-form-item>
											</template>
										</el-table-column>
										<el-table-column prop="item11" label="SW" align="center" min-width="120">
											<template slot-scope="scope">
												<el-form-item
													label-width="0px"
													:rules="rules.item11"
													:prop="'EZIDIRECTab.'+scope.$index+'.item11'"
												>
													<el-input
														maxlength="1"
														oninput="this.value=this.value.replace(/[^1-4\.]/g,'')"
														class="bigForm"
														v-model="scope.row.item11"
													></el-input>
												</el-form-item>
											</template>
										</el-table-column>
										<el-table-column prop="item12" label="WSW" min-width="120" align="center">
											<template slot-scope="scope">
												<el-form-item
													label-width="0px"
													:rules="rules.item12"
													:prop="'EZIDIRECTab.'+scope.$index+'.item12'"
												>
													<el-input
														maxlength="1"
														oninput="this.value=this.value.replace(/[^1-4\.]/g,'')"
														class="bigForm"
														v-model="scope.row.item12"
													></el-input>
												</el-form-item>
											</template>
										</el-table-column>
										<el-table-column prop="item13" label="W" align="center" min-width="120">
											<template slot-scope="scope">
												<el-form-item
													label-width="0px"
													:rules="rules.item13"
													:prop="'EZIDIRECTab.'+scope.$index+'.item13'"
												>
													<el-input
														maxlength="1"
														oninput="this.value=this.value.replace(/[^1-4\.]/g,'')"
														class="bigForm"
														v-model="scope.row.item13"
													></el-input>
												</el-form-item>
											</template>
										</el-table-column>
										<el-table-column prop="item14" label="WNW" min-width="120" align="center">
											<template slot-scope="scope">
												<el-form-item
													label-width="0px"
													:rules="rules.item14"
													:prop="'EZIDIRECTab.'+scope.$index+'.item14'"
												>
													<el-input
														maxlength="1"
														oninput="this.value=this.value.replace(/[^1-4\.]/g,'')"
														class="bigForm"
														v-model="scope.row.item14"
													></el-input>
												</el-form-item>
											</template>
										</el-table-column>
										<el-table-column prop="item15" label="NW" align="center" min-width="120">
											<template slot-scope="scope">
												<el-form-item
													label-width="0px"
													:rules="rules.item15"
													:prop="'EZIDIRECTab.'+scope.$index+'.item15'"
												>
													<el-input
														maxlength="1"
														oninput="this.value=this.value.replace(/[^1-4\.]/g,'')"
														class="bigForm"
														v-model="scope.row.item15"
													></el-input>
												</el-form-item>
											</template>
										</el-table-column>
										<el-table-column prop="item16" label="NNW" min-width="120" align="center">
											<template slot-scope="scope">
												<el-form-item
													label-width="0px"
													:rules="rules.item16"
													:prop="'EZIDIRECTab.'+scope.$index+'.item16'"
												>
													<el-input
														maxlength="1"
														oninput="this.value=this.value.replace(/[^1-4\.]/g,'')"
														class="bigForm"
														v-model="scope.row.item16"
													></el-input>
												</el-form-item>
											</template>
										</el-table-column>
									</el-table>
								</div>

								<el-form-item label prop="name"></el-form-item>
								<el-form-item label="撤离初始阶段时间" prop="EZDURBEG001">
									<el-input
										size="medium"
										class="mediumForm"
										oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,5})?).*$/g, '$1')"
										v-model="ruleForm.EZDURBEG001"
									>
										<template slot="append">s</template>
									</el-input>
								</el-form-item>
								<el-form-item label="撤离中期阶段时间" prop="EZDURMID001">
									<el-input
										size="medium"
										class="mediumForm"
										oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,5})?).*$/g, '$1')"
										v-model="ruleForm.EZDURMID001"
									>
										<template slot="append">s</template>
									</el-input>
								</el-form-item>
							</el-col>
						</el-row>
						<div class="separate m-b-20"></div>
						<el-row>
							<el-col :span="24">
								<div class="my_title">隐蔽设置</div>
								<el-form-item label="撤离和隐蔽参考的时间点" prop="EZREFPNT001">
									<select-para
										style="width:100%"
										size="medium"
										class="mediumForm"
										v-model="ruleForm.EZREFPNT001"
										:label.sync="ruleForm.EZREFPNT001"
										:options="EZREFPNT001options"
									></select-para>
								</el-form-item>
								<el-form-item label="撤离和隐蔽范围" prop="EZNUMEVA001">
									<select-para
										style="width:100%"
										size="medium"
										class="mediumForm"
										v-model="ruleForm.EZNUMEVA001"
										:label.sync="ruleForm.EZNUMEVA001Name"
										@change="EZNUMEVA001Change"
										:options="EZNUMEVA001options"
									></select-para>
								</el-form-item>

								<el-table ref="multipleTable" :data="ruleForm.EZDLTSHLTab" tooltip-effect="dark" border>
									<el-table-column prop="index" label="撤离和隐蔽范围" align="center" min-width="120"></el-table-column>
									<el-table-column prop="EZDLTSHL_VALUE" label="开始隐蔽时间(s)" align="center" min-width="120">
										<template slot-scope="scope">
											<el-form-item
												label-width="0px"
												:rules="rules.EZDLTSHL_VALUE"
												:prop="'EZDLTSHLTab.'+scope.$index+'.EZDLTSHL_VALUE'"
											>
												<el-input
													oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,20})?).*$/g, '$1')"
													class="bigForm"
													v-model="scope.row.EZDLTSHL_VALUE"
												></el-input>
											</el-form-item>
										</template>
									</el-table-column>
									<el-table-column prop="EZDLTEVA_VALUE" label="开始撤离时间(s)" min-width="120" align="center">
										<template slot-scope="scope">
											<el-form-item
												label-width="0px"
												:rules="rules.EZDLTEVA_VALUE"
												:prop="'EZDLTSHLTab.'+scope.$index+'.EZDLTEVA_VALUE'"
											>
												<el-input
													oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,20})?).*$/g, '$1')"
													class="bigForm"
													v-model="scope.row.EZDLTEVA_VALUE"
												></el-input>
											</el-form-item>
										</template>
									</el-table-column>
								</el-table>
							</el-col>
						</el-row>
						<div class="separate"></div>
						<el-row>
							<el-col :span="24">
								<div class="my_title m-b-20">其他设置</div>
								<el-form-item label="应急持续时间" prop="SRENDEMP001">
									<el-input
										size="medium"
										class="mediumForm"
										oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,5})?).*$/g, '$1')"
										v-model="ruleForm.SRENDEMP001"
									>
										<template slot="append">s</template>
									</el-input>
								</el-form-item>
								<el-form-item label="热点避迁开始时间" prop="SRTIMHOT001">
									<el-input
										size="medium"
										class="mediumForm"
										oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,5})?).*$/g, '$1')"
										v-model="ruleForm.SRTIMHOT001"
									>
										<template slot="append">s</template>
									</el-input>
								</el-form-item>
								<el-form-item label="正常避迁开始时间" prop="SRTIMNRM001">
									<el-input
										size="medium"
										class="mediumForm"
										oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,5})?).*$/g, '$1')"
										v-model="ruleForm.SRTIMNRM001"
									>
										<template slot="append">s</template>
									</el-input>
								</el-form-item>
								<el-form-item label="热点避迁剂量阈值" prop="SRDOSHOT001">
									<el-input
										size="medium"
										class="mediumForm"
										oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,5})?).*$/g, '$1')"
										v-model="ruleForm.SRDOSHOT001"
									>
										<template slot="append">sv</template>
									</el-input>
								</el-form-item>
								<el-form-item label="正常避迁剂量阈值" prop="SRDOSNRM001">
									<el-input
										size="medium"
										class="mediumForm"
										oninput="value=value.replace(/^\D*(\d*(?:\.\d{0,5})?).*$/g, '$1')"
										v-model="ruleForm.SRDOSNRM001"
									>
										<template slot="append">sv</template>
									</el-input>
								</el-form-item>
							</el-col>
						</el-row>
					</el-form>
				</div>
				<div class="bottom-btn">
					<el-button
						type="primary"
						:disabled="this.basic_Data.OCENDAT1001=='TRUE'"
						:loading="loading"
						@click="submitFun"
					>下一步</el-button>
				</div>
			</div>
		</div>
	</div>
</template>

<script>
import selectPara from "@/components/selectPara"
import commCheckbox from "@/components/commCheckbox"
import ImageCropper from "@/components/ImageCropper"
import FixBottomButton from "@/components/FixBottomButton"
import ueditor from "@/components/ueditor"
import textLength from "@/components/common/comp/textLength"
import { commPara } from "@/mixins/mixins"
import { mapState } from "vuex"
import { BATCH_DETAIL } from "@/service/hd5.js"
import { dome, selecttext, text } from "@/utils/verify.js"
import FileSaver from "file-saver"
import XLSX from "xlsx"
export default {
	name: "aboutUs",
	props: {
		basicDataF: Object,
	},
	mixins: [commPara],
	components: {
		selectPara,
		ImageCropper,
		textLength,
		commCheckbox,
		FixBottomButton,
		ueditor,
	},

	data() {
		var EZWTFRAC001 = (rule, value, callback) => {
			if (value == "") {
				callback(new Error("输入值不能为空"))
			} else if (value < 0.0 || value > 1.0) {
				callback(new Error("输入范围为[0.0，1.0]"))
			} else {
				callback()
			}
		}
		var EZESPEED001 = (rule, value, callback) => {
			value.forEach((item) => {
				if (item == "") {
					callback(new Error("输入值不能为空"))
				} else if (item < 1.0e-6 || item > 1.0e6) {
					callback(new Error("输入范围为 [1.0E-6，1.0E+6]"))
				} else {
					callback()
				}
			})
		}
		var EZDURBEG = (rule, value, callback) => {
			if (value == "") {
				callback(new Error("输入值不能为空"))
			} else if (value < 0.0 || value > 86400) {
				callback(new Error("输入范围为[0.0，86400]"))
			} else {
				callback()
			}
		}
		var SRENDEMP001 = (rule, value, callback) => {
			if (value == "") {
				callback(new Error("输入值不能为空"))
			} else if (value < 86400 || value > 604800) {
				callback(new Error("输入范围为[86400，604800]"))
			} else {
				callback()
			}
		}
		var SRTIMHOT001 = (rule, value, callback) => {
			if (value == "") {
				callback(new Error("输入值不能为空"))
			} else if (value < 0.0 || value > this.ruleForm.SRENDEMP001) {
				callback(
					new Error(
						"输入范围为[0.0，" + this.ruleForm.SRENDEMP001 + "]"
					)
				)
			} else {
				callback()
			}
		}
		var SRTIMNRM001 = (rule, value, callback) => {
			if (value == "") {
				callback(new Error("输入值不能为空"))
			} else if (
				value < parseFloat(this.ruleForm.SRTIMHOT001) ||
				value > parseFloat(this.ruleForm.SRENDEMP001)
			) {
				callback(
					new Error(
						"输入范围为[" +
							this.ruleForm.SRTIMHOT001 +
							"，" +
							this.ruleForm.SRENDEMP001 +
							"]"
					)
				)
			} else {
				callback()
			}
		}
		var SRDOSHOT001 = (rule, value, callback) => {
			if (value == "") {
				callback(new Error("输入值不能为空"))
			} else if (value < 0.0 || value > 1.0e10) {
				callback(new Error("输入范围为[0.0，1.0e+10]"))
			} else {
				callback()
			}
		}
		var SRDOSNRM001 = (rule, value, callback) => {
			if (value == "") {
				callback(new Error("输入值不能为空"))
			} else if (value < 0.0 || value > this.ruleForm.SRDOSHOT001) {
				callback(
					new Error(
						"输入范围为[0.0，" + this.ruleForm.SRDOSHOT001 + "]"
					)
				)
			} else {
				callback()
			}
		}
		var selecttext1 = (rule, value, callback) => {
			if (value == "") {
				callback(new Error("输入值不能为空"))
			} else {
				callback()
			}
		}
		
		return {
			activeTab: "7",
			GENUMRAD001: "5",
			allNuclide: [
				{
					ISOTPGRP_NAM: "2016-05-03",
					ISOTPGRP_GRP: "王小虎",
					RDCORINV_COR: 0,
				},
			],
			groupNuclide: [
				{
					ISMAXGRP001: "",
					ISDEPFLA_DRY: "TRUE",
					ISDEPFLA_WET: "TRUE",
				},
			],

			ruleForm: {
				EZWTNAME001: "PEOPLE",
				EZWTFRAC001: "0.95",
				EZLASMOV001: "",
				EZLASMOV001name: "",
				TRAVELPOINT: "BOUNDARY",
				EZESPEED001: [1.8, 1.8, 1.8],
				EZEVATYP001: "RADIAL",
				EZDURBEG001: "86400",
				EZDURMID001: "0",
				EZREFPNT001: "ALARM",
				SRENDEMP001: "604800",
				SRTIMHOT001: "43200",
				SRTIMNRM001: "86400",
				SRDOSHOT001: "0.5",
				SRDOSNRM001: "0.25",
				EZIDIRECTab: [],
				EZDLTSHLTab: [],
				EZNUMEVA001: [],
				EZNUMEVA001Name: [],
			},
			rules: {
				EZWTFRAC001: [
					{
						validator: EZWTFRAC001,
						trigger: ["change", "blur"],
					},
				],
				EZESPEED001: [
					{
						validator: EZESPEED001,
						trigger: ["change", "blur"],
					},
				],
				EZDURBEG001: [
					{
						validator: EZDURBEG,
						trigger: ["change", "blur"],
					},
				],
				EZNUMEVA001: [
					{
						validator: selecttext1,
						trigger: ["change", "blur"],
					},
				],
				EZLASMOV001: [
					{
						validator: selecttext1,
						trigger: ["change", "blur"],
					},
				],
				EZDURMID001: [
					{
						validator: EZDURBEG,
						trigger: ["change", "blur"],
					},
				],
				SRENDEMP001: [
					{
						validator: SRENDEMP001,
						trigger: ["change", "blur"],
					},
				],
				SRTIMHOT001: [
					{
						validator: SRTIMHOT001,
						trigger: ["change", "blur"],
					},
				],
				SRTIMNRM001: [
					{
						validator: SRTIMNRM001,
						trigger: ["change", "blur"],
					},
				],
				SRDOSHOT001: [
					{
						validator: SRDOSHOT001,
						trigger: ["change", "blur"],
					},
				],
				SRDOSNRM001: [
					{
						validator: SRDOSNRM001,
						trigger: ["change", "blur"],
					},
				],
				EZDURBEG001: [
					{
						validator: dome(0.0, 86400),
						trigger: ["change", "blur"],
					},
				],
				EZDLTSHL_VALUE: [
					{
						validator: dome(0.0, 86400),
						trigger: ["change", "blur"],
					},
				],
				EZDLTEVA_VALUE: [
					{
						validator: dome(0.0, 86400),
						trigger: ["change", "blur"],
					},
				],
			},
			EZWTNAME001options: [
				{
					label: "TIME",
					value: "TIME",
				},
				{
					label: "PEOPLE",
					value: "PEOPLE",
				},
				{
					label: "SUMPOP",
					value: "SUMPOP",
				},
			],
			TRAVELPOINToptions: [
				{
					label: "BOUNDARY",
					value: "BOUNDARY",
				},
				{
					label: "CENTERPOINT",
					value: "CENTERPOINT",
				},
			],
			EZEVATYP001options: [
				{
					label: "RADIAL",
					value: "RADIAL",
				},
				{
					label: "NETWORK",
					value: "NETWORK",
				},
			],
			EZREFPNT001options: [
				{
					label: "ALARM",
					value: "ALARM",
				},
				{
					label: "ARRIVAL",
					value: "ARRIVAL",
				},
			],
			RDAPLFRCoptions: [
				{
					label: "PARENT",
					value: "PARENT",
				},
				{
					label: "PROGENY",
					value: "PROGENY",
				},
			],
			EZNUMEVA001options: [],

			loading: false,
		}
	},
	computed: {
		...mapState({
			early_Data: (state) => state.token.early_Data,
			basic_Data: (state) => state.token.basic_Data,
		}),
		EZLASMOV001options: function () {
			let temp = this.basic_Data.GESPAEND_DISTANCE.map((item, index) => {
				return {
					label: item,
					value: index + 1,
				}
			})
			return temp
		},
	},
	mounted() {
		this.setData()
	},
	methods: {
		setData() {
			this.ruleForm.EZWTNAME001 = this.early_Data.EZWTNAME001
				? this.early_Data.EZWTNAME001
				: "PEOPLE"
			this.ruleForm.EZWTFRAC001 = this.early_Data.EZWTFRAC001
				? this.early_Data.EZWTFRAC001.toString()
				: "0.95"
			this.ruleForm.EZLASMOV001 = this.early_Data.EZLASMOV001
				? this.early_Data.EZLASMOV001
				: ""
			this.ruleForm.TRAVELPOINT = this.early_Data.TRAVELPOINT
				? this.early_Data.TRAVELPOINT
				: "BOUNDARY"
			if (this.ruleForm.EZESPEED001.length > 0) {
				this.ruleForm.EZESPEED001 = this.early_Data.EZESPEED001
			}
			this.ruleForm.EZEVATYP001 = this.early_Data.EZEVATYP001
				? this.early_Data.EZEVATYP001
				: "RADIAL"
			if (this.ruleForm.EZEVATYP001 == "NETWORK") {
				let temp2 = JSON.parse(
					JSON.stringify(this.basic_Data.GESPAEND_DISTANCE)
				)
				temp2.splice(0, this.early_Data.EZLASMOV001 - 1)
				this.ruleForm.EZIDIRECTab = temp2.map((item, index) => {
					console.log(this.early_Data.EZIDIREC[index][0])
					return {
						index: item,
						item1: this.early_Data.EZIDIREC[index][0]
							? this.early_Data.EZIDIREC[index][0]
							: "0",
						item2: this.early_Data.EZIDIREC[index][1]
							? this.early_Data.EZIDIREC[index][1]
							: "0",
						item3: this.early_Data.EZIDIREC[index][2]
							? this.early_Data.EZIDIREC[index][2]
							: "0",
						item4: this.early_Data.EZIDIREC[index][3]
							? this.early_Data.EZIDIREC[index][3]
							: "0",
						item5: this.early_Data.EZIDIREC[index][4]
							? this.early_Data.EZIDIREC[index][4]
							: "0",
						item6: this.early_Data.EZIDIREC[index][5]
							? this.early_Data.EZIDIREC[index][5]
							: "0",
						item7: this.early_Data.EZIDIREC[index][6]
							? this.early_Data.EZIDIREC[index][6]
							: "0",
						item8: this.early_Data.EZIDIREC[index][7]
							? this.early_Data.EZIDIREC[index][7]
							: "0",
						item9: this.early_Data.EZIDIREC[index][8]
							? this.early_Data.EZIDIREC[index][8]
							: "0",
						item10: this.early_Data.EZIDIREC[index][9]
							? this.early_Data.EZIDIREC[index][9]
							: "0",
						item11: this.early_Data.EZIDIREC[index][10]
							? this.early_Data.EZIDIREC[index][10]
							: "0",
						item12: this.early_Data.EZIDIREC[index][11]
							? this.early_Data.EZIDIREC[index][11]
							: "0",
						item13: this.early_Data.EZIDIREC[index][12]
							? this.early_Data.EZIDIREC[index][12]
							: "0",
						item14: this.early_Data.EZIDIREC[index][13]
							? this.early_Data.EZIDIREC[index][13]
							: "0",
						item15: this.early_Data.EZIDIREC[index][14]
							? this.early_Data.EZIDIREC[index][14]
							: "0",
						item16: this.early_Data.EZIDIREC[index][15]
							? this.early_Data.EZIDIREC[index][15]
							: "0",
					}
				})
			}
			this.ruleForm.EZDURBEG001 = this.early_Data.EZDURBEG001
				? this.early_Data.EZDURBEG001.toString()
				: "86400"
			this.ruleForm.EZDURMID001 = this.early_Data.EZDURMID001
				? this.early_Data.EZDURMID001.toString()
				: "0"
			this.ruleForm.EZREFPNT001 = this.early_Data.EZREFPNT001
				? this.early_Data.EZREFPNT001
				: "ALARM"
			this.ruleForm.EZNUMEVA001 = this.early_Data.EZNUMEVA001
				? this.early_Data.EZNUMEVA001
				: ""

			this.ruleForm.SRENDEMP001 = this.early_Data.SRENDEMP001
				? this.early_Data.SRENDEMP001.toString()
				: "604800"
			this.ruleForm.SRTIMHOT001 = this.early_Data.SRTIMHOT001
				? this.early_Data.SRTIMHOT001.toString()
				: "43200"
			this.ruleForm.SRTIMNRM001 = this.early_Data.SRTIMNRM001
				? this.early_Data.SRTIMNRM001.toString()
				: "86400"
			this.ruleForm.SRDOSHOT001 = this.early_Data.SRDOSHOT001
				? this.early_Data.SRDOSHOT001.toString()
				: "0.5"
			this.ruleForm.SRDOSNRM001 = this.early_Data.SRDOSNRM001
				? this.early_Data.SRDOSNRM001.toString()
				: "0.25"
		},
		EZLASMOV001Change(value) {
			this.EZNUMEVA001options = []
			let temp = JSON.parse(
				JSON.stringify(this.basic_Data.GESPAEND_DISTANCE)
			).splice(0, value)
			this.EZNUMEVA001options = temp.map((item, index) => {
				return {
					label: item,
					value: index + 1,
				}
			})

			if (this.ruleForm.EZEVATYP001 == "NETWORK") {
				let temp2 = JSON.parse(
					JSON.stringify(this.basic_Data.GESPAEND_DISTANCE)
				)
				temp2.splice(0, value - 1)
				this.ruleForm.EZIDIRECTab = temp2.map((item, index) => {
					return {
						index: item,
						item1: this.early_Data.EZIDIREC[index]
							? this.early_Data.EZIDIREC[index][0]
							: "0",
						item2: this.early_Data.EZIDIREC[index]
							? this.early_Data.EZIDIREC[index][1]
							: "0",
						item3: this.early_Data.EZIDIREC[index]
							? this.early_Data.EZIDIREC[index][2]
							: "0",
						item4: this.early_Data.EZIDIREC[index]
							? this.early_Data.EZIDIREC[index][3]
							: "0",
						item5: this.early_Data.EZIDIREC[index]
							? this.early_Data.EZIDIREC[index][4]
							: "0",
						item6: this.early_Data.EZIDIREC[index]
							? this.early_Data.EZIDIREC[index][5]
							: "0",
						item7: this.early_Data.EZIDIREC[index]
							? this.early_Data.EZIDIREC[index][6]
							: "0",
						item8: this.early_Data.EZIDIREC[index]
							? this.early_Data.EZIDIREC[index][7]
							: "0",
						item9: this.early_Data.EZIDIREC[index]
							? this.early_Data.EZIDIREC[index][8]
							: "0",
						item10: this.early_Data.EZIDIREC[index]
							? this.early_Data.EZIDIREC[index][9]
							: "0",
						item11: this.early_Data.EZIDIREC[index]
							? this.early_Data.EZIDIREC[index][10]
							: "0",
						item12: this.early_Data.EZIDIREC[index]
							? this.early_Data.EZIDIREC[index][11]
							: "0",
						item13: this.early_Data.EZIDIREC[index]
							? this.early_Data.EZIDIREC[index][12]
							: "0",
						item14: this.early_Data.EZIDIREC[index]
							? this.early_Data.EZIDIREC[index][13]
							: "0",
						item15: this.early_Data.EZIDIREC[index]
							? this.early_Data.EZIDIREC[index][14]
							: "0",
						item16: this.early_Data.EZIDIREC[index]
							? this.early_Data.EZIDIREC[index][15]
							: "0",
					}
				})
			}
		},
		exportExcel() {
			//导出Excel
			var that = this
			//要导出数据标题
			var arry = [
				[
					"编号",
					"N",
					"NNE",
					"NE",
					"ENE",
					"E",
					"ESE",
					"SE",
					"SSE",
					"S",
					"SSW",
					"SW",
					"WSW",
					"W",
					"WNW",
					"NW",
					"NNW",
				],
			]
			// 要导出的历史数据
			that.ruleForm.EZIDIRECTab.map((a) => {
				var _arry = []
				_arry.push(a.index.toString())
				_arry.push(a.item1.toString())
				_arry.push(a.item2.toString())
				_arry.push(a.item3.toString())
				_arry.push(a.item4.toString())
				_arry.push(a.item5.toString())
				_arry.push(a.item6.toString())
				_arry.push(a.item7.toString())
				_arry.push(a.item8.toString())
				_arry.push(a.item9.toString())
				_arry.push(a.item10.toString())
				_arry.push(a.item11.toString())
				_arry.push(a.item12.toString())
				_arry.push(a.item13.toString())
				_arry.push(a.item14.toString())
				_arry.push(a.item15.toString())
				_arry.push(a.item16.toString())
				return _arry
			}).forEach((a) => {
				arry.push(a)
			})
			/* generate workbook object from table */
			var sheetHistory = XLSX.utils.aoa_to_sheet(arry)
			var workbook = XLSX.utils.book_new()
			XLSX.utils.book_append_sheet(workbook, sheetHistory, "撤离网格")
			sheetHistory["!cols"] = [{ wpx: 150 }, { wpx: 90 }, { wpx: 150 }] //单元格列宽

			try {
				var wbOut = XLSX.write(workbook, {
					bookType: "xlsx",
					bookSST: true,
					type: "array",
				})
				FileSaver.saveAs(
					new Blob([wbOut], { type: "application/octet-stream" }),
					"撤离网格.xlsx"
				)
			} catch (e) {
				if (typeof console !== "undefined") console.log(e, wbOut)
			}
		},
		importf(obj) {
			//导入数据
			let _this = this
			let inputDOM = this.$refs.inputer // 通过DOM取文件数据
			this.file = event.currentTarget.files[0]
			var rABS = false //是否将文件读取为二进制字符串
			var f = this.file
			var reader = new FileReader()
			//if (!FileReader.prototype.readAsBinaryString) {
			FileReader.prototype.readAsBinaryString = function (f) {
				var binary = ""
				var rABS = false //是否将文件读取为二进制字符串
				var pt = this
				var wb //读取完成的数据
				var outdata
				var reader = new FileReader()
				reader.onload = function (e) {
					var bytes = new Uint8Array(reader.result)
					var length = bytes.byteLength
					for (var i = 0; i < length; i++) {
						binary += String.fromCharCode(bytes[i])
					}
					var XLSX = require("xlsx")
					if (rABS) {
						wb = XLSX.read(btoa(fixdata(binary)), {
							//手动转化
							type: "base64",
						})
					} else {
						wb = XLSX.read(binary, {
							type: "binary",
						})
					}
					outdata = XLSX.utils.sheet_to_json(
						wb.Sheets[wb.SheetNames[0]]
					)
					// excel 数据再处理
					let arr = []
					outdata.map((v) => {
						let obj = {}
						obj.index = v.编号
						obj.item1 = v.N
						obj.item2 = v.NNE
						obj.item3 = v.NE
						obj.item4 = v.ENE
						obj.item5 = v.E
						obj.item6 = v.ESE
						obj.item7 = v.SE
						obj.item8 = v.SSE
						obj.item9 = v.S
						obj.item10 = v.SSW
						obj.item11 = v.SW
						obj.item12 = v.WSW
						obj.item13 = v.W
						obj.item14 = v.WNW
						obj.item15 = v.NW
						obj.item16 = v.NNW
						arr.push(obj)
					})
					_this.ruleForm.EZIDIRECTab = [...arr]
				}
				reader.readAsArrayBuffer(f)
			}
			if (rABS) {
				reader.readAsArrayBuffer(f)
			} else {
				reader.readAsBinaryString(f)
			}
		},
		daoru() {
			this.$refs.file.click()
		},
		EZNUMEVA001Change(value) {
			let temp = JSON.parse(
				JSON.stringify(this.basic_Data.GESPAEND_DISTANCE)
			).splice(0, value)
			this.ruleForm.EZDLTSHLTab = temp.map((item, index) => {
				return {
					index: item,
					EZDLTSHL_VALUE: this.early_Data.EZDLTSHL_VALUE[index]
						? this.early_Data.EZDLTSHL_VALUE[index].toString()
						: "0",
					EZDLTEVA_VALUE: this.early_Data.EZDLTEVA_VALUE[index]
						? this.early_Data.EZDLTEVA_VALUE[index].toString()
						: "0",
				}
			})
		},

		submitFun() {
			//保存
			this.$refs.form.validate((valid) => {
				if (valid) {
					let tempdata = JSON.parse(JSON.stringify(this.early_Data))
					tempdata.EZWTNAME001 = this.ruleForm.EZWTNAME001
					tempdata.EZWTFRAC001 = parseFloat(this.ruleForm.EZWTFRAC001)
					tempdata.EZLASMOV001 = parseInt(this.ruleForm.EZLASMOV001)
					tempdata.TRAVELPOINT = this.ruleForm.TRAVELPOINT
					tempdata.EZESPEED001 = this.ruleForm.EZESPEED001.map(
						(item) => {
							return parseFloat(item)
						}
					)
					tempdata.EZEVATYP001 = this.ruleForm.EZEVATYP001
					tempdata.EZIDIREC = this.ruleForm.EZIDIRECTab.map(
						(item) => {
							let temp = []
							for (const key in item) {
								if (item.hasOwnProperty(key)) {
									const element = item[key]
									temp.push(
										parseInt(element)
											? parseInt(element)
											: 0
									)
								}
							}
							temp.splice(0, 1)
							return temp
						}
					)
					tempdata.EZDURBEG001 = parseFloat(this.ruleForm.EZDURBEG001)
					tempdata.EZDURMID001 = parseFloat(this.ruleForm.EZDURMID001)
					tempdata.EZREFPNT001 = this.ruleForm.EZREFPNT001
					tempdata.EZNUMEVA001 = parseInt(this.ruleForm.EZNUMEVA001)
					tempdata.EZDLTSHL_VALUE = this.ruleForm.EZDLTSHLTab.map(
						(item) => {
							return parseFloat(item.EZDLTSHL_VALUE)
						}
					)
					tempdata.EZDLTEVA_VALUE = this.ruleForm.EZDLTSHLTab.map(
						(item) => {
							return parseFloat(item.EZDLTEVA_VALUE)
						}
					)
					tempdata.SRENDEMP001 = parseFloat(this.ruleForm.SRENDEMP001)
					tempdata.SRTIMHOT001 = parseFloat(this.ruleForm.SRTIMHOT001)
					tempdata.SRTIMNRM001 = parseFloat(this.ruleForm.SRTIMNRM001)
					tempdata.SRDOSHOT001 = parseFloat(this.ruleForm.SRDOSHOT001)
					tempdata.SRDOSNRM001 = parseFloat(this.ruleForm.SRDOSNRM001)
					tempdata.SETPAGEINDEX = this.activeTab
					this.$store.dispatch("upData_early_Data", tempdata)
					let params = {
						batchid: this.$route.query.id,
						batchinfo: "ZAOQI",
						submitjson: JSON.stringify(tempdata),
					} 
					this.$appApi
						.BATCH_SUBMIT(params)
						.then((res) => { 
							var str = res.data.substring(0, 1)
							if (str == "E") {
								let message = res.data.substring(6)
								this.$notify.error({
									title: "保存失败！",
									message: message,
									type: "success",
								})
							} else if (str == "S") {
								this.$notify({
									message: "保存成功！",
									type: "success",
								})
							}
						})
						.catch((err) => {
							console.log(err)
						})
					this.$emit("changeActiveTab", this.activeTab)
					this.$store.dispatch("change_early_showTab", this.activeTab)
				}
			})
		},
	},
}
</script>
<style lang="scss" scoped>
.page-flex-row /deep/ .el-collapse-item__header {
	background: #f3f9fe;
}
.operation {
	width: 95%;
	height: 80px;
	display: flex;
	justify-content: flex-end;
	align-items: center;
}
#img-upload {
	display: none;
}
</style>